< previous page page_12 next page >

Page 12
0012-01.jpg
Figure 1.7.
The completed data entry form for Titles.
You can now run the program and see the data control in action. Select Run | Start (or press F5) to compile and run your program. You can walk through the data table by clicking the left and right arrows on the data control at the bottom of the form. The left-most arrow (the one with the bar on it) moves you to the first record in the data table. The right-most arrow (which also has a bar) moves you to the last record in the data table. The other two arrows simply move you through the data table one record at a time.
You can make any changes permanent to the data table by moving to a different record in the table. Try this by changing the data in the Title input control, moving the record pointer to the next record, and then moving the pointer back to the record you just edited. You will see that the new value was saved to the data table.
Now let's include the capability to add new records to the data table and to delete existing records from the data table.
Adding the New and Delete Command Buttons
Up to this point, you have not written a single line of Visual Basic code. However, in order to add the capability to insert new records and delete existing records, you have to write a grand total of two lines of Visual Basic code: one line for the add record function, and one line for the delete record function.
The first step in the process is to add two command buttons labeled Add and Delete to the form. Refer to Table 1.3 and Figure 1.8 for details on adding the command buttons to your form.

 
< previous page page_12 next page >

If you like this book, buy it!